Skip to content

🧪 test: add stdlib module detection tests#7

Merged
bashandbone merged 3 commits intomainfrom
jules-12721888822113959734-8553a13a
Mar 13, 2026
Merged

🧪 test: add stdlib module detection tests#7
bashandbone merged 3 commits intomainfrom
jules-12721888822113959734-8553a13a

Conversation

@bashandbone
Copy link
Contributor

🎯 What: The testing gap addressed
The _is_stdlib_module method in ASTParser was missing tests, specifically for edge cases like passing "" or None.

📊 Coverage: What scenarios are now tested

  • Empty or None module names
  • Common stdlib modules (e.g. sys, os, pathlib)
  • Stdlib submodules (e.g. os.path)
  • Non-stdlib modules (e.g. requests, numpy, exportify)
  • Internal stdlib modules starting with an underscore (e.g. _ast, _io)

Result: The improvement in test coverage
The _is_stdlib_module method is now fully covered by unit tests, ensuring future refactoring won't break its behavior for valid or invalid inputs. I also added a ruff: noqa directive to sample_type_aliases.py to prevent formatting from breaking existing alias detection tests.


PR created automatically by Jules for task 12721888822113959734 started by @bashandbone

Add `TestStdlibModuleDetection` to verify `ASTParser._is_stdlib_module` handles edge cases like `""` and `None` correctly. Also add tests for common stdlib modules, submodules, non-stdlib modules, and internal modules to improve code coverage.

Add `# ruff: noqa: UP040` to `sample_type_aliases.py` to prevent ruff from updating the pre-3.12 alias syntax and breaking other tests.

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings March 13, 2026 02:26
type ConfigDict = dict[str, str | int | bool | list[str]]
type NamePair = tuple[str, str]
# ruff: noqa: UP040
FilePath: TypeAlias = str | Path
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit test coverage for ASTParser._is_stdlib_module edge cases and updates the type-alias fixture to preserve “pre-3.12” alias style under Ruff.

Changes:

  • Add a new TestStdlibModuleDetection test class covering empty/None, stdlib modules/submodules, non-stdlib modules, and internal underscore-prefixed modules.
  • Update tests/fixtures/sample_type_aliases.py to use TypeAlias assignments for pre-3.12-style aliases and add a Ruff suppression for UP040.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_ast_parser.py Adds direct unit tests for stdlib module detection helper.
tests/fixtures/sample_type_aliases.py Restores mixed alias styles (TypeAlias + type) and suppresses Ruff’s UP040 rewrite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

bashandbone and others added 2 commits March 12, 2026 23:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
@bashandbone bashandbone merged commit d28aba0 into main Mar 13, 2026
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants